#pragma once

#include <iostream>
#include <vector>
#include <ctime>
typedef void (*task_t)();
void PrintLog()
{
    std::cout << "我是一个打印日志的任务" << std::endl;
}

void Download()
{
    std::cout << "我是一个下载的任务" << std::endl;
}

void Upload()
{
    std::cout << "我是一个上传的任务" << std::endl;
}
class task
{
public:
    task()
    {
        srand(time(nullptr));
    }
    void AddFun(task_t t)
    {
        tk.push_back(t);
    }
    int code()
    {
        return rand()%tk.size();
    }
    void Execute(int code)
    {
        if(code>=0)
        tk[code]();
    }
    ~task()
    {
    }

private:
    std::vector<task_t> tk;
};